"use client"

import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { LogIn } from "lucide-react"
import { useState } from "react"

interface LoginModalProps {
  onClose: () => void
  onLogin: (userData: any) => void
}

export function LoginModal({ onClose, onLogin }: LoginModalProps) {
  const [formData, setFormData] = useState({
    email: "",
    password: "",
  })

  const handleSubmit = (e) => {
    e.preventDefault()
    // 模拟登录
    const userData = {
      id: "1",
      name: "张明华",
      email: formData.email,
      company: "华创科技集团",
      position: "CEO",
      industry: "tech",
      membership: "vip",
      avatar: "/placeholder.svg?height=40&width=40",
    }
    onLogin(userData)
  }

  return (
    <Dialog open={true} onOpenChange={onClose}>
      <DialogContent className="max-w-md">
        <DialogHeader>
          <DialogTitle className="flex items-center space-x-2">
            <LogIn className="w-5 h-5" />
            <span>用户登录</span>
          </DialogTitle>
        </DialogHeader>

        <form onSubmit={handleSubmit} className="space-y-4">
          <div className="space-y-2">
            <Label htmlFor="email">邮箱</Label>
            <Input
              id="email"
              type="email"
              placeholder="请输入邮箱"
              value={formData.email}
              onChange={(e) => setFormData({ ...formData, email: e.target.value })}
              required
            />
          </div>
          <div className="space-y-2">
            <Label htmlFor="password">密码</Label>
            <Input
              id="password"
              type="password"
              placeholder="请输入密码"
              value={formData.password}
              onChange={(e) => setFormData({ ...formData, password: e.target.value })}
              required
            />
          </div>

          <div className="flex justify-between items-center text-sm">
            <label className="flex items-center space-x-2">
              <input type="checkbox" className="rounded" />
              <span>记住我</span>
            </label>
            <Button variant="link" className="p-0 h-auto text-sm">
              忘记密码？
            </Button>
          </div>

          <div className="flex space-x-2">
            <Button type="button" variant="outline" onClick={onClose} className="flex-1 bg-transparent">
              取消
            </Button>
            <Button type="submit" className="flex-1">
              登录
            </Button>
          </div>
        </form>

        <div className="text-center text-sm text-slate-500">
          还没有账号？
          <Button variant="link" className="p-0 h-auto text-sm">
            立即注册
          </Button>
        </div>
      </DialogContent>
    </Dialog>
  )
}
